package com.yc.spring;

import com.yc.spring.bbs.bean.User;
import com.yc.spring.bbs.bean.YcUser;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.*;

//配置类 ===  beans.xml
@Configuration  //配置类注解

//组件扫描
@ComponentScan("com.yc")
//开启asppect 自动代理
@EnableAspectJAutoProxy

public class IocConfig {

//<bean>  ==> Bean 方法
    @Bean
    @Primary  //primary="true"
    User user(){
        User user = new User();
        user.setUname("zhangsan");
        return user ;
    }

    @Bean("user1")
    @Lazy
    @Scope("prototype")

    User user1(){
        User user1 =  YcUser.create();
        user1.setUname("lishi");

        return user1 ;
    }

}
